{#模板导入#}
{% extends 'layout/basic.html' %}
{#静态文件的导入#}
{% load static %}
{#title自定义#}
{% block title %}多方式登录{% endblock %}

{#css自定义#}
{% block css %}
    <link rel="stylesheet" href="{% static 'css/account.css' %}">
    <style>
        .error-msg {
            color: #ff0000;
            position: absolute;
            font-size: 13px;
        }
    </style>
{% endblock %}

{#内容自定义#}
{% block content %}
    <div class="account">
        <div class="title">用户登录</div>
        <form id="regForm" method="POST" action="" novalidate>
            {% csrf_token %}
            {% for field in form %}
                {% if field.name == 'code' %}

                    <div class="form-group">
                        <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                        <div class="row">
                            <div class="col-xs-7">
                                {{ field }}
                                <span class="error-msg">{{ field.errors.0 }}</span>
                            </div>
                            <div class="col-xs-5">
                                <img src="{% url 'code' %}" id="imgCode" title="点击有奇迹发生哦">
                            </div>
                        </div>
                    </div>
                {% else %}
                    <div class="form-group">
                        <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                        {{ field }}
                        <span class="error-msg">{{ field.errors.0 }}</span>
                    </div>
                {% endif %}
            {% endfor %}
            <div>
                <div style="float: right">
                    <a href="{% url 'login' %}">短信登录？</a>
                </div>

                <div class="row">
                    <div class="col-xs-3">

                        <input id="btnRi" type="submit" class="btn btn-success" value="登 录"/>
                    </div>
                </div>
        </form>
    </div>
{% endblock %}

{#js自定义#}
{% block js %}

    <script>
        $(function () {
            $('#imgCode').click(function () {
                var OldSrc = $(this).attr('src');
                $(this).attr('src', OldSrc + "?");

            })
        })//看着简约，用着方便，感觉大气，这是我们的宗旨
    </script>



{% endblock %}